package com.y.architecture.base_header;

import android.graphics.Color;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.y.architecture.base.NeedInitViewHelper;
import com.y.architecture.util.AFLog;


/**
 * Created by youjingjing on 2017/11/24.
 */

public class BaseHeaderHelper extends NeedInitViewHelper<IBaseHeaderContact.IBaseHeaderView> implements IBaseHeaderContact.IBaseHeaderPresenter{

    public BaseHeaderHelper(IBaseHeaderContact.IBaseHeaderView mBaseView) {
        super(mBaseView);
    }

    public BaseHeaderHelper(IBaseHeaderContact.IBaseHeaderView mBaseView, View mRoot) {
        super(mBaseView, mRoot);
    }


    @Override
    public Toolbar initToolbar() {
        Toolbar toolbar = null;
        try {
            toolbar = getView(mBaseView.getToolbarId());
            toolbar.setTitle(mBaseView.getTitleText());
            toolbar.setTitleTextColor(Color.parseColor("#fcefe8"));
//            toolbar.setTitle("123");
            toolbar.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mBaseView.onToolbarClicked(v);
                }
            });
            toolbar.setVisibility(mBaseView.isShowToolbar() ? View.VISIBLE : View.GONE);
        } catch (Exception e) {
            AFLog.w("未设置标题id~");
        }
        return toolbar;
    }


}
